package a01demo1;

import java.util.ArrayList;

public class Test1 {
    public static void main(String[] args) {
        ArrayList<String> list1 = new ArrayList<>();
        list1.add("ab");
        list1.add("a");
        list1.add("ac");
        ArrayList<String> list2 = new ArrayList<>();

        for (String s : list1) {
            if (s.startsWith("a")) {
                list2.add(s);
            }
        }
        System.out.println(list2);

        ArrayList<String> list3 = new ArrayList<>();

        for (String s : list2) {
            if(s.length()==2){
                list3.add(s);
            }
        }
        System.out.println(list3);
    }
}
